Skip to main content

MySQL Installation

Remote server connection from Termius. Run this command to identify the server's OS:

cat /etc/os-release

The server OS is Ubuntu, so from now on the commands to install MySQL are meant for Ubuntu only.

  1. Update the package list
sudo apt update
  1. Install MySQL Server
sudo apt install -y mysql-server
  1. Start MySQL
sudo systemctl start mysql
  1. Enable MySQL on boot
sudo systemctl enable mysql
  1. Run the security script
sudo mysql_secure_installation

The script will ask you to set a root password, remove anonymous users, and disable remote root login. Answer Y to all.

  1. Verify MySQL version
mysql --version
  1. Connect to MySQL
sudo mysql
  1. Verify the installation — inside the MySQL shell run:
SHOW DATABASES;

If you see information_schema, mysql, performance_schema, and sys, the installation is all done!